

package projectx.web.base;

import game.web.base.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import projectx.web.base.navi.Function;

public final class ProjectXForwardAction extends ProjectXSecurityAction {

    //--------------------------------------------------------------------------
    //   M E T H O D S
    //
    //--------------------------------------------------------------------------
    protected boolean isPostMethodOnly(){ return false; }

    protected boolean requireFunctionInSession(){ return false; }

    protected ActionForward execute( User                user,
                                     Function            function,
                                     ActionMapping       mapping,
                                     ActionForm          form,
                                     HttpServletRequest  request,
                                     HttpSession         session,
                                     HttpServletResponse response )
        throws Exception
    {
    	System.err.println("ProjectXForwardAction start--->execute");
        cleanupSession( request, session );
        String funcId = "index";
        UserContext uc = ( UserContext ) session.getAttribute( ConstantsProjectX.USER_CONTEXT );
        if( uc == null ){
        	uc = new UserContext();
        }
        uc.put(ConstantsProjectX.FUNC_ID, funcId );
        session.setAttribute( ConstantsProjectX.USER_CONTEXT , uc );
        
    	System.err.println("ProjectXForwardAction end--->execute funcId="+funcId);
        return findForward( mapping, funcId );
    }
}
